//
// Created by alexander on 17.08.18.
//

#include <Eigen/Dense>

using namespace Eigen;

MatrixXcd solver_opt_pnp_hesch2_red(const VectorXd& data)
{
// Action =  z
// Quotient ring basis (V) = 1,x,x^2,x^2*z,x^2*z^2,x*y,x*y*z,x*y*z^2,x*z,x*z^2,x*z^3,x*z^4,y,y^2,y^3,y^2*z,y^2*z^2,y*z,y*z^2,y*z^3,y*z^4,z,z^2,z^3,z^4,z^5,z^6,
// Available monomials (RR*V) = x^2*z^3,x*y*z^3,x*z^5,y^3*z,y^2*z^3,y*z^5,z^7,1,x,x^2,x^2*z,x^2*z^2,x*y,x*y*z,x*y*z^2,x*z,x*z^2,x*z^3,x*z^4,y,y^2,y^3,y^2*z,y^2*z^2,y*z,y*z^2,y*z^3,y*z^4,z,z^2,z^3,z^4,z^5,z^6,

    const double* d = data.data();
    VectorXd coeffs(49);
    coeffs[0] = 4*d[44];
    coeffs[1] = 3*d[45] + 3*d[54];
    coeffs[2] = 2*d[47] + 2*d[55] + 2*d[74];
    coeffs[3] = d[57] + d[75];
    coeffs[4] = 3*d[46] + 3*d[64];
    coeffs[5] = 2*d[48] + 2*d[56] + 2*d[65] + 2*d[84];
    coeffs[6] = d[58] + d[67] + d[76] + d[85];
    coeffs[7] = 2*d[49] + 2*d[66] + 2*d[94];
    coeffs[8] = d[59] + d[68] + d[86] + d[95];
    coeffs[9] = d[69] + d[96];
    coeffs[10] = 3*d[14] + 3*d[41];
    coeffs[11] = 2*d[15] + 2*d[24] + 2*d[42] + 2*d[51];
    coeffs[12] = d[17] + d[25] + d[52] + d[71];
    coeffs[13] = 2*d[16] + 2*d[34] + 2*d[43] + 2*d[61];
    coeffs[14] = d[18] + d[26] + d[35] + d[53] + d[62] + d[81];
    coeffs[15] = d[19] + d[36] + d[63] + d[91];
    coeffs[16] = 2*d[4] + 2*d[11] + 2*d[40];
    coeffs[17] = d[5] + d[12] + d[21] + d[50];
    coeffs[18] = d[6] + d[13] + d[31] + d[60];
    coeffs[19] = d[1] + d[10];
    coeffs[20] = d[45] + d[54];
    coeffs[21] = 3*d[57] + 3*d[75];
    coeffs[22] = 4*d[77];
    coeffs[23] = d[48] + d[56] + d[65] + d[84];
    coeffs[24] = 2*d[58] + 2*d[67] + 2*d[76] + 2*d[85];
    coeffs[25] = 3*d[78] + 3*d[87];
    coeffs[26] = 2*d[79] + 2*d[88] + 2*d[97];
    coeffs[27] = d[89] + d[98];
    coeffs[28] = d[15] + d[24] + d[42] + d[51];
    coeffs[29] = 2*d[17] + 2*d[25] + 2*d[52] + 2*d[71];
    coeffs[30] = 3*d[27] + 3*d[72];
    coeffs[31] = 2*d[28] + 2*d[37] + 2*d[73] + 2*d[82];
    coeffs[32] = d[29] + d[38] + d[83] + d[92];
    coeffs[33] = 2*d[7] + 2*d[22] + 2*d[70];
    coeffs[34] = d[8] + d[23] + d[32] + d[80];
    coeffs[35] = d[2] + d[20];
    coeffs[36] = d[46] + d[64];
    coeffs[37] = d[78] + d[87];
    coeffs[38] = 2*d[59] + 2*d[68] + 2*d[86] + 2*d[95];
    coeffs[39] = 3*d[69] + 3*d[96];
    coeffs[40] = 3*d[89] + 3*d[98];
    coeffs[41] = 4*d[99];
    coeffs[42] = d[16] + d[34] + d[43] + d[61];
    coeffs[43] = d[28] + d[37] + d[73] + d[82];
    coeffs[44] = 2*d[19] + 2*d[36] + 2*d[63] + 2*d[91];
    coeffs[45] = 2*d[29] + 2*d[38] + 2*d[83] + 2*d[92];
    coeffs[46] = 3*d[39] + 3*d[93];
    coeffs[47] = 2*d[9] + 2*d[33] + 2*d[90];
    coeffs[48] = d[3] + d[30];

    static const int coeffs_ind[] = {0,20,36,1,0,20,2,36,23,2,1,2,21,23,6,3,2,21,22,6,37,3,22,37,0,20,1,0,20,2,36,4,23,2,1,0,20,2,21,36,23,7,5,4,23,24,7,3,2,1,
                                     2,21,22,23,6,38,6,5,24,25,38,3,2,21,22,6,37,26,6,25,26,3,22,37,0,20,36,4,23,1,0,20,2,36,23,5,4,23,24,2,1,0,20,2,21,36,23,7,6,7,
                                     8,6,5,4,23,24,25,3,2,1,2,21,22,23,7,6,38,39,37,8,7,8,26,39,6,5,24,25,3,2,21,22,6,38,37,26,40,8,26,40,6,25,3,22,37,26,4,23,0,20,
                                     36,7,7,8,5,4,23,24,1,20,0,2,36,23,7,38,8,7,8,26,6,5,4,23,24,25,2,2,1,21,23,7,6,38,39,26,9,27,8,7,8,26,6,5,24,25,3,21,2,22,
                                     6,38,39,37,26,40,41,9,27,41,8,26,6,25,22,3,37,26,40,7,8,4,23,20,36,0,7,39,9,27,8,7,8,26,5,23,4,24,7,2,23,1,38,39,40,9,27,8,7,8,
                                     26,6,24,5,25,38,21,6,39,2,26,40,41,9,27,8,26,25,6,26,22,37,40,41,3,9,27,7,8,23,7,4,39,41,9,27,8,8,7,26,39,24,38,5,40,41,9,27,26,8,
                                     40,25,26,41,6,9,27,8,39,7,41,27,9,41,26,40,8,20,0,2,0,20,1,36,10,28,42,21,1,20,2,0,36,2,23,11,10,28,29,42,14,22,2,2,21,1,23,3,6,12,
                                     11,29,30,14,43,3,21,22,2,6,37,12,30,43,22,3,37,20,0,36,10,28,23,2,0,20,1,36,4,23,11,10,28,29,42,24,4,23,21,1,20,2,0,36,2,23,5,7,6,13,
                                     14,12,11,10,28,29,30,42,14,44,25,5,23,24,4,7,22,2,2,21,1,23,3,6,6,38,37,14,13,14,31,44,12,11,29,30,14,43,45,6,24,25,5,38,3,21,22,2,6,37,
                                     26,14,31,45,12,30,43,25,6,26,22,3,37,10,28,23,20,0,4,36,7,42,13,14,11,10,28,29,42,8,24,4,23,2,1,20,36,5,23,0,7,7,38,14,14,13,14,31,12,11,
                                     10,28,29,30,42,14,44,26,7,8,25,5,23,24,4,7,21,2,2,23,6,6,1,38,8,39,26,43,15,32,14,13,14,31,12,11,29,30,14,44,43,45,46,8,8,26,7,39,6,24,
                                     25,5,38,22,3,21,6,37,2,26,40,15,32,46,14,31,12,30,43,45,26,8,40,25,6,26,22,37,3,13,14,10,28,42,8,23,4,7,0,36,20,7,39,44,15,32,14,13,14,31,
                                     11,28,10,29,42,14,44,27,26,7,8,24,5,23,7,8,1,23,2,38,4,39,9,40,45,15,32,14,13,14,31,12,29,11,30,14,44,43,45,46,9,27,8,8,26,7,39,25,6,24,
                                     38,2,6,21,26,5,40,41,15,32,14,31,30,12,43,45,46,27,9,41,26,8,40,25,26,3,37,22,6,15,32,13,14,28,42,10,44,27,8,7,9,4,7,23,39,41,46,15,32,14,
                                     14,13,31,44,29,14,11,45,46,9,27,26,8,8,39,5,38,24,40,7,41,15,32,31,14,45,30,43,46,12,27,9,41,26,40,6,26,25,8,20,0,36,28,10,2,20,1,0,36,23,
                                     29,10,28,11,21,2,36,20,2,1,23,0,42,6,16,17,18,30,11,28,29,10,42,12,22,21,23,2,3,2,6,1,14,37,17,16,17,33,18,34,12,29,30,11,14,22,6,21,3,37,
                                     2,43,17,33,34,30,12,43,37,22,3,28,10,23,4,20,0,36,7,42,16,17,14,29,10,28,11,42,13,24,23,5,4,2,0,36,1,20,23,7,38,14,17,16,17,33,18,31,13,14,
                                     30,11,28,29,10,42,12,14,14,25,24,7,23,6,5,21,1,23,2,2,6,38,4,44,26,43,18,34,17,16,17,33,18,34,47,14,14,31,13,44,12,29,30,11,14,43,25,38,24,6,
                                     22,2,6,3,21,37,26,5,45,18,34,47,17,33,34,31,14,45,30,12,43,26,25,3,37,22,6,16,17,14,28,10,13,42,8,7,23,4,36,7,20,0,39,44,18,18,34,17,16,17,
                                     33,18,32,31,13,14,29,11,28,42,14,14,10,44,15,26,8,8,7,24,4,7,5,23,23,38,2,39,1,40,45,34,18,34,17,16,17,33,18,34,47,15,32,14,14,31,13,44,30,12,
                                     29,14,43,11,45,26,39,8,8,25,5,38,6,24,6,26,21,40,7,2,46,18,34,17,33,34,47,32,15,46,31,14,45,30,43,12,40,26,6,26,25,37,22,8,3,28,10,36,0,20,
                                     42,17,16,29,28,11,10,42,23,36,1,20,2,0,14,33,16,17,17,30,29,42,28,12,11,14,6,23,2,2,21,10,18,1,43,19,35,48,17,17,33,16,18,30,14,29,12,43,37,6,
                                     3,21,22,11,34,2,19,35,48,33,17,34,43,30,37,22,12,3,17,16,14,13,28,10,42,7,4,23,20,36,0,44,18,19,35,34,33,16,17,17,18,18,31,14,14,13,29,10,42,11,
                                     28,14,44,38,7,5,23,24,2,23,1,4,45,34,19,35,48,18,34,17,17,33,16,18,34,31,44,14,14,30,11,14,12,29,43,45,26,38,6,24,25,21,6,2,13,47,5,17,16,42,
                                     10,28,0,36,20,18,35,19,33,17,17,16,18,14,42,11,28,29,1,23,10,2,34,19,35,33,18,17,17,34,43,14,12,29,30,2,6,16,48,11,21,18,34,16,17,18,32,14,13,15,
                                     10,42,28,44,27,9,8,7,7,39,23,4,41,46,47,18,34,17,17,16,33,18,34,47,15,32,31,14,14,44,11,14,29,45,13,46,27,9,26,7,39,8,8,38,40,24,41,5,15,32,
                                     14,44,13,46,27,9,7,39,8,41,19,35,48,34,18,47,33,17,34,45,31,12,43,30,26,25,22,37,3,14,6,18,34,33,17,34,47,32,15,46,31,45,12,43,30,14,41,27,8,40,
                                     26,26,25,9,6,32,15,46,31,45,14,27,41,8,40,26,9,27,41,9,19,48,35,48,19,35,16,18,17,35,19,18,16,17,10,42,28,48,35,19,34,18,17,16,18,44,13,14,28,42,
                                     10,4,7,23,47,48,19,35,34,17,16,18,18,32,15,14,13,42,44,28,39,7,8,23,7,4,10,46,47,48,35,19,48,34,18,17,17,33,11,14,16,29,19,35,48,34,18,33,16,18,
                                     17,17,34,47,45,44,14,14,31,29,14,11,5,38,13,24,19,35,48,18,34,33,17,17,18,34,16,47,32,15,31,13,44,14,14,14,45,29,46,40,39,8,8,26,24,38,5,11,7,35,
                                     19,48,47,18,34,17,18,16,13,44,14,35,19,48,34,18,18,47,17,46,15,32,14,44,13,7,39,16,8,19,35,48,34,18,16,18,17,47,32,15,44,46,14,41,9,27,8,39,7,13,
                                     18,34,17,18,16,47,32,15,13,44,14,46,27,9,39,41,8,7,48,35,17,34,19,33,48,35,34,33,12,43,19,17,30,35,19,48,34,33,43,30,3,37,17,12,22,35,19,48,47,34,
                                     17,34,33,45,31,30,43,12,6,26,18,14,25,19,35,48,34,18,47,33,34,17,46,32,14,45,31,43,30,40,26,25,26,6,15,12,8,19,48,35,47,34,33,34,17,14,45,18,31,35,
                                     48,19,18,47,34,34,33,46,32,31,45,14,8,40,17,15,26,35,19,48,34,47,17,34,33,18,15,46,32,45,31,41,27,26,40,8,14,9,34,18,47,33,34,17,32,46,14,45,31,15,
                                     9,41,27,40,26,8,35,48,19,18,47,34,48,35,34,47,18,15,46,19,32,19,48,35,47,34,32,46,15,9,41,18,27,35,48,19,18,47,34,46,32,27,41,9,15,34,47,18,15,46,
                                     32,41,27,9,32,46,15,9,41,27};

    static const int C_ind[] = {0,3,30,88,89,90,91,92,118,176,177,178,179,180,206,264,265,266,267,268,294,353,354,356,445,450,533,534,537,538,557,616,619,621,622,623,624,625,626,641,645,646,704,705,706,707,708,709,710,711,
                                712,713,714,729,733,734,792,793,794,795,796,798,799,800,801,817,821,822,881,882,884,887,888,905,979,984,1055,1061,1066,1067,1068,1071,1072,1084,1143,1149,1150,1153,1154,1155,1156,1157,1158,1159,1160,1168,1172,1173,1231,1232,
                                1235,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1256,1257,1260,1261,1262,1319,1320,1321,1322,1323,1324,1326,1327,1328,1329,1332,1333,1334,1335,1344,1345,1348,1349,1350,1409,1410,1412,1415,1416,1421,1422,1432,1433,1507,1512,1513,1516,
                                1523,1583,1589,1594,1595,1596,1599,1600,1601,1602,1603,1604,1605,1611,1612,1671,1677,1678,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1696,1699,1700,1701,1759,1760,1763,1766,1767,1768,1769,1772,1773,1774,1775,1777,1778,1779,1780,
                                1781,1784,1785,1787,1788,1789,1790,1849,1850,1852,1855,1856,1861,1862,1866,1867,1869,1872,1873,1947,1952,1953,1956,1958,1959,1962,1963,2023,2029,2034,2035,2036,2039,2040,2041,2042,2043,2044,2045,2046,2047,2050,2051,2052,2111,2118,2121,2124,2125,2126,
                                2127,2129,2130,2131,2132,2133,2134,2135,2136,2138,2139,2140,2141,2207,2208,2213,2214,2218,2219,2221,2222,2223,2224,2225,2226,2299,2304,2305,2308,2310,2311,2314,2315,2375,2388,2391,2393,2394,2395,2396,2397,2398,2399,2402,2403,2404,2477,2478,2482,2483,
                                2485,2486,2487,2488,2490,2569,2572,2574,2575,2578,2579,2658,2659,2661,2662,2663,2666,2759,2782,2847,2848,2850,2870,2898,2904,2907,2934,2935,2936,2937,2938,2939,2940,2958,2986,2992,2993,2994,2995,2996,3022,3023,3024,3025,3026,3027,3028,3046,3074,3080,
                                3081,3082,3083,3084,3110,3112,3113,3114,3115,3116,3162,3169,3170,3172,3201,3203,3204,3293,3303,3342,3349,3354,3375,3381,3382,3384,3391,3397,3398,3430,3437,3438,3441,3442,3461,3463,3464,3466,3469,3470,3471,3472,3473,3474,3479,3485,3486,3514,3518,3520,
                                3523,3525,3526,3527,3528,3529,3530,3545,3549,3550,3551,3552,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3567,3573,3574,3602,3606,3608,3609,3610,3611,3612,3614,3615,3616,3617,3633,3637,3638,3640,3641,3642,3643,3644,3646,3647,3648,3649,3650,3661,
                                3690,3697,3698,3700,3703,3704,3721,3729,3731,3732,3735,3737,3738,3795,3800,3821,3827,3828,3831,3835,3870,3871,3877,3882,3883,3884,3887,3888,3900,3903,3909,3910,3912,3915,3916,3917,3918,3919,3923,3924,3925,3926,3958,3959,3965,3966,3969,3970,3971,3972,
                                3973,3974,3975,3976,3984,3988,3989,3991,3992,3994,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4011,4012,4013,4014,4042,4046,4047,4048,4051,4054,4055,4056,4057,4060,4061,4062,4063,4072,4073,4076,4077,4078,4080,4081,4082,4083,4084,4086,4087,
                                4088,4089,4090,4091,4092,4093,4094,4099,4100,4101,4130,4137,4138,4140,4143,4144,4149,4150,4160,4161,4169,4171,4172,4175,4177,4178,4181,4182,4188,4235,4240,4241,4244,4251,4261,4267,4268,4271,4272,4273,4274,4275,4310,4311,4317,4322,4323,4324,4327,4328,
                                4329,4330,4331,4332,4333,4339,4340,4343,4349,4350,4352,4355,4356,4357,4358,4359,4360,4361,4362,4363,4364,4365,4366,4398,4399,4406,4409,4412,4413,4414,4415,4417,4418,4419,4420,4421,4424,4427,4428,4429,4432,4434,4438,4439,4440,4441,4442,4443,4444,4445,
                                4446,4448,4449,4450,4451,4452,4453,4482,4495,4496,4501,4502,4506,4507,4509,4512,4513,4521,4523,4524,4527,4529,4530,4533,4534,4536,4537,4538,4540,4587,4592,4593,4596,4598,4599,4602,4603,4613,4619,4620,4623,4624,4625,4626,4627,4662,4663,4676,4679,4681,
                                4682,4683,4684,4685,4686,4687,4690,4691,4692,4702,4704,4707,4708,4709,4710,4712,4713,4714,4715,4716,4717,4765,4766,4770,4771,4773,4774,4775,4776,4778,4791,4793,4794,4797,4798,4800,4801,4802,4804,4895,4899,4925,4959,4982,4983,4984,4987,4988,4997,5013,
                                5047,5048,5050,5070,5071,5072,5073,5074,5075,5076,5085,5096,5098,5101,5104,5107,5134,5135,5136,5137,5138,5139,5140,5158,5159,5160,5161,5162,5163,5164,5173,5184,5186,5189,5192,5193,5194,5195,5196,5222,5224,5225,5226,5227,5228,5248,5249,5250,5252,5261,
                                5272,5274,5281,5282,5284,5313,5315,5316,5337,5338,5360,5405,5415,5423,5427,5429,5432,5435,5453,5454,5461,5466,5487,5493,5494,5496,5503,5509,5510,5511,5512,5515,5516,5517,5518,5519,5520,5521,5523,5525,5541,5542,5549,5550,5553,5554,5573,5575,5576,5578,
                                5581,5582,5583,5584,5585,5586,5591,5597,5598,5599,5600,5601,5602,5603,5604,5605,5606,5607,5608,5609,5611,5613,5624,5626,5629,5630,5632,5635,5638,5639,5640,5641,5657,5661,5662,5664,5665,5666,5667,5668,5670,5671,5672,5673,5674,5685,5688,5689,5690,5692,
                                5693,5694,5695,5696,5697,5699,5701,5712,5714,5721,5722,5724,5727,5728,5745,5753,5755,5756,5759,5761,5762,5777,5778,5782,5783,5785,5800,5819,5824,5845,5851,5852,5855,5859,5863,5867,5869,5872,5874,5875,5876,5889,5893,5894,5895,5901,5906,5907,5908,5911,
                                5912,5924,5927,5933,5934,5936,5939,5940,5941,5942,5943,5947,5948,5949,5950,5951,5952,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5977,5981,5982,5983,5990,5993,5996,5997,5998,5999,6008,6012,6013,6016,6018,6022,6023,6024,6025,6026,6027,6028,
                                6029,6030,6035,6036,6037,6040,6041,6042,6044,6045,6046,6047,6048,6049,6050,6051,6052,6053,6064,6065,6066,6079,6080,6085,6086,6096,6097,6105,6107,6108,6111,6113,6114,6117,6118,6124,6129,6130,6134,6135,6137,6138,6140,6152,6153,6215,6219,6230,6232,6234,
                                6245,6279,6302,6303,6304,6307,6308,6317,6318,6319,6320,6321,6322,6331,6333,6367,6368,6370,6390,6391,6392,6393,6394,6395,6396,6405,6406,6407,6408,6409,6410,6416,6418,6419,6421,6424,6427,6454,6456,6457,6458,6459,6460,6480,6481,6482,6484,6493,6494,6495,
                                6496,6497,6498,6504,6506,6507,6513,6514,6516,6545,6547,6548,6569,6570,6583,6585,6592,6595,6637,6647,6655,6659,6661,6664,6667,6670,6672,6674,6675,6676,6677,6685,6686,6693,6698,6719,6725,6726,6728,6735,6741,6742,6743,6744,6747,6748,6749,6750,6751,6752,
                                6753,6755,6757,6758,6759,6760,6761,6762,6763,6764,6765,6771,6773,6774,6782,6785,6805,6808,6810,6814,6815,6816,6817,6818,6829,6832,6833,6834,6836,6837,6838,6839,6840,6841,6843,6845,6846,6847,6848,6849,6850,6851,6852,6853,6856,6858,6859,6919,6923,6934,
                                6936,6938,6942,6943,6948,6949,6983,7006,7007,7008,7011,7012,7021,7022,7023,7024,7025,7026,7030,7031,7035,7036,7037,7072,7074,7096,7097,7098,7100,7109,7110,7111,7112,7113,7114,7118,7119,7120,7122,7123,7124,7139,7144,7145,7148,7155,7165,7171,7172,7175,
                                7176,7177,7178,7179,7183,7187,7189,7192,7194,7195,7196,7209,7213,7214,7215,7228,7231,7233,7234,7235,7236,7237,7243,7244,7254,7256,7259,7260,7261,7262,7264,7265,7266,7267,7268,7269,7272,7276,7277,7278,7279,7280,7281,7282,7283,7284,7285,7297,7321,7324,
                                7326,7327,7330,7331,7347,7348,7352,7353,7354,7355,7399,7400,7417,7425,7427,7428,7431,7433,7434,7449,7450,7454,7455,7457,7463,7465,7467,7468,7469,7472,7475,7493,7494,7498,7499,7501,7504,7519,7521,7522,7525,7526,7528,7529,7530,7532,7537,7538,7542,7543,
                                7545,7546,7548,7560,7561,7586,7587,7589,7590,7591,7594,7613,7614,7616,7617,7618,7620,7678,7679,7682,7822,7823,7828,7902,7904,7906,7910,7911,7916,7975,7979,7990,7992,7994,7998,7999,8004,8005,8045,8055,8063,8067,8069,8072,8075,8078,8080,8082,8083,8084,
                                8085,8086,8087,8092,8093,8094,8107,8112,8133,8139,8140,8143,8147,8151,8155,8157,8160,8162,8163,8164,8166,8168,8170,8171,8172,8173,8177,8181,8182,8183,8240,8244,8253,8254,8255,8256,8257,8258,8262,8263,8267,8268,8310,8312,8325,8328,8332,8333,8334,8335,
                                8336,8337,8339,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8355,8356,8372,8375,8388,8398,8400,8403,8404,8405,8406,8411,8412,8413,8416,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437,8441,8443,8509,
                                8512,8515,8518,8520,8522,8523,8524,8525,8526,8527,8532,8579,8580,8587,8597,8600,8602,8603,8604,8606,8608,8610,8611,8612,8613,8614,8615,8617,8620,8641,8644,8651,8667,8668,8672,8673,8674,8675,8685,8688,8690,8691,8692,8694,8696,8698,8699,8700,8701,8705,
                                8729,8732,8734,8735,8738,8739,8755,8756,8760,8761,8762,8763,8773,8776,8778,8779,8780,8793,8871,8873,8878,8879,8883,8884,8945,8946,8959,8961,8966,8967,8968,8971,8972,9009,9011,9012,9033,9034,9047,9049,9054,9055,9056,9059,9060,9103,9105,9106,9121,9122,
                                9126,9127,9129,9135,9137,9139,9140,9141,9142,9143,9144,9147,9148,9165,9166,9176,9191,9193,9194,9197,9198,9204,9209,9210,9214,9215,9217,9218,9220,9223,9225,9227,9228,9229,9232,9233,9235,9302,9303,9305,9311,9313,9315,9316,9317,9318,9319,9323,9324,9373,
                                9374,9380,9390,9391,9393,9394,9396,9399,9401,9403,9404,9405,9406,9407,9409,9411,9412,9434,9435,9437,9461,9462,9464,9465,9466,9468,9478,9479,9481,9482,9484,9487,9489,9491,9492,9493,9497,9499,9522,9523,9525,9526,9527,9530,9549,9550,9552,9553,9554,9556,
                                9566,9567,9569,9570,9572,9585,9667,9668,9669,9670,9671,9676,9746,9748,9755,9756,9757,9758,9759,9761,9764,9816,9817,9818,9834,9836,9843,9844,9845,9846,9847,9849,9852,9878,9879,9882,9904,9905,9906,9922,9924,9931,9932,9933,9937,9966,9967,9970,9992,9993,
                                9994,10010,10012,10025,10054,10055,10058,10080,10081,10082};

    MatrixXd C = MatrixXd::Zero(88,115);
    for (int i = 0; i < 1760; i++) {
        C(C_ind[i]) = coeffs(coeffs_ind[i]);
    }

    MatrixXd C0 = C.leftCols(88);
    MatrixXd C1 = C.rightCols(27);
    MatrixXd C12 = C0.fullPivLu().solve(C1);
    MatrixXd RR(34, 27);
    RR << -C12.bottomRows(7), MatrixXd::Identity(27, 27);

    static const int AM_ind[] = {28,15,10,11,0,13,14,1,16,17,18,2,24,22,3,23,4,25,26,27,5,29,30,31,32,33,6};
    MatrixXd AM(27, 27);
    for (int i = 0; i < 27; i++) {
        AM.row(i) = RR.row(AM_ind[i]);
    }

    EigenSolver<MatrixXd> es(AM);
    ArrayXcd D = es.eigenvalues();
    ArrayXXcd V = es.eigenvectors();
    V = (V / V.row(0).replicate(27, 1)).eval();

    MatrixXcd sols(3, 27);
    sols.row(0) = V.row(1);
    sols.row(1) = V.row(12);
    sols.row(2) = D.transpose();
    return sols;
}